
<form method="POST">
    From : <input type="text" name="rating">.<br>
    To :   <input type="text" name="rating1">.<br>
    <input type="submit" name="submit" value="Search">
</form>
<?php if (isset($_POST['submit'])): ?>
    <?php $rating = (double) $_POST['rating']; ?>
    <?php $rating1 = (double) $_POST['rating1']; ?>
<?php endif; ?>
<?php
    $file_name = "../ptnhuan-web1/data/films.txt";
    $file_patch = realpath($file_name);   
    $films = array();
    $file = fopen($file_patch,"r");
    while (!feof($file)) {
        $films[] = trim(fgets($file));
}   
    fclose($file);
?>
<?php foreach ($films as $line):?>
    <?php if (!empty($line)):?>
    <?php  $film = explode(";", $line);?>
<?php echo $film[0]; ?>
<img src="../ptnhuan-web1/public/images/films/<?php echo $film[1]; ?>">
     <?php echo $film[2]; ?>
    <?php echo $film[3]; ?>
<a href="edit.php">Edit</a>
</br>
<?php endif;?>    
<?php  endforeach; ?>

